<template>
  <div class="newsInfocontainer">
    <h1 class="title">{{newsInfo.title}}</h1>
    <p class="subTitle">
      <span>发表时间：{{newsInfo.add_time|dateFormate}}</span>
      <span>点击：{{newsInfo.click}}次</span>
    </p>
    <hr>
    <div class="newsContent" v-html="newsInfo.content"></div>
    <comentbox :id='id'></comentbox>
  </div>
</template>

<script>
import {Toast} from 'mint-ui'
import comment from '../subVue/comment.vue'
export default {
  data(){
    return {
      id:this.$route.params.id,
      newsInfo:{
        title:'新闻资讯',
        click:33,
        add_time:Date.now(),
        content:'<p>新闻资讯内容</p>'
      }
    }
  },
  methods:{
    getNewsInfo(){
      this.$http.get('/api/getnew/:newid'+this.id).then(ret=>{
        if(ret.status==0){
          this.newsInfo=ret.message[0]
        }else{
          Toast('新闻加载失败')
        }
      })
    }
  },
  components:{
    'comentbox':comment
  }
}
</script>
<style lang="scss">
.newsInfocontainer{
  padding:0 4px;
  .title{
    font-size: 16px;
    text-align: center;
    margin: 15px 0;
    color: red;
  }
  .subTitle{
    font-size: 13px;
    color: #226aff;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
  }
  .newsContent{
    img{
      width: 100%;
    }
  }
}
</style>
